package com.bestdreamer.synch.account2;

public class DepositThread extends Thread {
    // 模拟用户账户
    private final Account account;
    // 当前取钱线程所希望存的钱数
    private final double depositAmount;

    public DepositThread(String name, Account account, double depositAmount){
        super(name);
        this.account = account;
        this.depositAmount = depositAmount;
    }

    // 重复 100 此执行存钱操作
    public void run(){
        for( int i = 0; i < 100; i++){
            account.deposit(depositAmount);
        }
    }
}
